package hk.linkcredit.walletservice.wallet.service.strategy;

import hk.linkcredit.walletservice.constant.Status;
import hk.linkcredit.walletservice.exception.BizException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: jamnsin
 * @Date: 2022/6/12 16:33
 */
@Component
public class BalanceService {

    @Resource
    private Map<String, BalanceStrategy> balanceStrategyMap;

    public BalanceStrategy getBalanceStrategy(String type) {
        BalanceStrategy balanceStrategy = balanceStrategyMap.get(type);
        if (balanceStrategy == null) {
            throw new BizException(Status.SYSTEM_EXCEPTION);
        }
        return balanceStrategyMap.get(type);
    }

}
